# 单无人机 南瓜 RANK

from utils import *
l = get_world_size()

map = []

def action0(x,y):
    till()
    plant(Entities.Pumpkin)
    use_item(Items.Water)
    
def action(x,y):
    map.append((x,y))
    plant(Entities.Pumpkin)
    pourwater(.25)
    
snake_traverse_from_cur(l,0,0,l-1,l-1,action0)

round = 0
while num_items(Items.Pumpkin) < 10000000:
    snake_traverse_from_cur(l,0,0,l-1,l-1,action)
    while 1:
        round = round + 1
        growing_map = []
        for pos in map:
            goto(l,pos[0],pos[1])
            if not can_harvest():
                plant(Entities.Pumpkin)
                if round > 3:
                    pourwater(.9)
                    if num_items(Items.Fertilizer) > 5 and len(map) == 1:
                        use_item(Items.Fertilizer)
                elif round > 1:
                    pourwater(.75)
                growing_map.append(pos)

        map = growing_map
        if len(map) == 0:
            harvest()
            round = 0
            break
